package com.app.data;

import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

import com.app.activity.R;

public class InnItem extends ListDataModel {

	private String name;
	private String site;
	private int drawId;
	private int leveldrawId;
	private String money;
	private String htmlContent;
	
	private Bitmap iconbitmap;
	
	public Bitmap getIconbitmap() {
		return iconbitmap;
	}

	public void setIconbitmap(Bitmap iconbitmap) {
		this.iconbitmap = iconbitmap;
	}

	public InnItem(){}
	
	public InnItem(String name,String site,int drawId,int leveldrawId,String money){
		this.name=name;
		this.site=site;
		this.drawId=drawId;
		this.leveldrawId=leveldrawId;
		this.money=money;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSite() {
		return site;
	}

	public void setSite(String site) {
		this.site = site;
	}

	public int getDrawId() {
		return drawId;
	}

	public void setDrawId(int drawId) {
		this.drawId = drawId;
	}

	public String getMoney() {
		return money;
	}

	public void setMoney(String money) {
		this.money = money;
	}

	public int getLeveldrawId() {
		return leveldrawId;
	}

	public void setLeveldrawId(int leveldrawId) {
		this.leveldrawId = leveldrawId;
	}

	
	
	public String getHtmlContent() {
		return htmlContent;
	}

	public void setHtmlContent(String htmlContent) {
		this.htmlContent = htmlContent;
	}

	public static InnItem item(String name, String site, int drawId,
			String money) {
		InnItem item = item(name, site, drawId, money, R.drawable.star5);
		return item;
	}

	
	
	public static InnItem item(String name, String site, int drawId,
			String money, int leveldrawId) {
		InnItem item = new InnItem();
		item.setName(name);
		item.setSite(site);
		item.setDrawId(drawId);
		item.setMoney(money);
		item.setLeveldrawId(leveldrawId);
		return item;
	}

	@Override
	public View mapInContentview(View contentView, LayoutInflater inflater) {
		HotelHolder holder;
		// 此处view缓存会造成切换view切换问题
		// if (contentView == null) {
		contentView = inflater.inflate(R.layout.inn_list_item, null);
		holder = new HotelHolder();
		holder.img = (ImageView) contentView.findViewById(R.id.imgInnIcon);
		holder.name = (TextView) contentView.findViewById(R.id.tvInnName);
		holder.content = (TextView) contentView.findViewById(R.id.tvInnAddress);
		holder.money = (TextView) contentView.findViewById(R.id.tvInnPrice);
		contentView.setTag(holder);
		// }else
		// {
		// Object obj =
		// holder = (HotelHolder)contentView.getTag();
		// }
		holder.img.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// ActivityTools.gotoActivity(contentView,
				// HotelScheduledActivity.class);

			}
		});

		holder.img.setImageResource(drawId);
		holder.name.setText(name);
		holder.content.setText(site);
		holder.money.setText(money);

		return contentView;
	}

	class HotelHolder {
		ImageView img;
		TextView name;
		TextView content;
		TextView money;
	}
}
